<?php

$titulo = get("titulo");
$descricao = get("descricao");
$categoria = get("categoria");

if(!isset($_GET['usuario'])){
	header("Location: index.php?pg=login");
}
else{
	
?>
<div class="container">
<h4>Etapa 2</h4>
<h5>Vamos l&aacute, s&oacute mais um pouquinho...</h5>

<div class="row">
<form class="form form-horizontal" method="post" action="salvarAnuncio.php" enctype="multipart/form-data">
<div class="span8">
	<div class="row">
		<div class="span4">
			<div class="row">
				<div class="span4">
					<label>T&iacutetulo</label>		
					<input class="span4" type ="text" name="titulo" value = "<?php echo $titulo; ?>">
				</div>
			</div>		
			<div class="row">
				<div class="span4">
					<label>Categoria</label>
					<select class="span4" name="categoria" value="<?php echo $categoria; ?>">
							<?php
							$rs = mysql_query("SELECT * FROM `categorias` WHERE `categorias`.`id_categoria` LIKE $categoria ORDER BY `nome_categoria`");
							while($row = mysql_fetch_array($rs)){
								$categoria_id= $row['id_categoria'];
								$nome = $row['nome_categoria'];
			
							?>
							<option value="<?php echo $categoria_id; ?>" disabled="disabled">
								<?php echo $nome; ?>
							</option>
							<?php }	
						?>
					</select>
				</div>
			</div>
			<div class="row">
				<div class="span4">
					<label>SubCategoria</label>		
					<select class="span4" name="categoria" value="<?php echo $categoria; ?>">
							<?php
							$rs = mysql_query("SELECT * FROM `subcategorias` WHERE `subcategorias`.`categoria_id` LIKE $categoria ORDER BY `nome_subcategoria`");
							while($row = mysql_fetch_array($rs)){
								$subcategoria_id= $row['id_subcategoria'];
								$nome = $row['nome_subcategoria'];
			
							?>
							<option value="<?php echo $subcategoria_id; ?>">
								<?php echo $nome; ?>
							</option>
							<?php }	
						?>
					</select>
				</div>
			</div>
			<div class="row">
				<div class="span4">
					<label>Descricao</label>		
					<textarea class="span4" name="descricao" value = "<?php echo $descricao; ?>"></textarea>
				</div>
			</div>
			<div class="row">
				<div class="span4">
					<label>imagens</label>		
					<input class="span4" type ="file" name="fotos[]">
				</div>
			</div>
			
		</div>
		<div class="span3">
			<div class="fb-like-box" data-href="https://www.facebook.com/revistaaquitem?fref=ts" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="false"></div>
		</div>
	</div>
	
</div>	
	
	</form>
	</div>
</div>
<?php }?>